<template>
    <div class="userActions">
        <div class="container h-100">
            <div class="row h-50">
                <div class="col pt-2">
                    <actions-item :message="user.id" name="用户ID">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-credit-card-2-front" style="color: #ff6283"></i>
                        </template>
                    </actions-item>
                </div>
                <div class="col pt-2">
                    <actions-item :message="user.userName" name="用户名">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-person-lines-fill" style="color: #74ff6d"></i>
                        </template>
                    </actions-item>
                </div>
                <div class="col pt-2">
                    <actions-item :message="user.userPhone" name="电话号码">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-phone-vibrate" style="color: #b757ff"></i>
                        </template>
                    </actions-item>
                </div>
            </div>
            <div class="row h-50">
                <div class="col pt-2">
                    <actions-item :message="user.userEmail" name="电子邮箱">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-envelope-fill" style="color: #3d23ff"></i>
                        </template>
                    </actions-item>
                </div>
                <div class="col pt-2">
                    <actions-item :message="user.creationTime" name="注册日期">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-calendar-week" style="color: #ffb259"></i>
                        </template>
                    </actions-item>
                </div>
                <div class="col pt-2">
                    <actions-item :message="user.userSex" name="用户性别">
                        <template v-slot:actionsItemIcon>
                            <i class="bi bi-exclude" style="color: #ff2850"></i>
                        </template>
                    </actions-item>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import $ from 'jquery'
    import actionsItem from "./actionsItem";

    export default {
        name: "userActions",
        components:{
            actionsItem
        },
        data() {
            return {
                user: {
                    id: '',
                    userName: '',
                    userSex: '',
                    userEmail: '',
                    userPhone: '',
                    creationTime: ''
                }
            }
        },
      
        mounted() {
            this.GetList();
            this.GetList();
        },
        methods: {
            GetList(){
                this.axios
                .get("https://localhost:44347/api/app/p-user/user?userEmail="+localStorage.getItem('name'))
                .then(s=>
                {
                        
                        this.user.id=s.data.id
                        this.user.userName=s.data.userName
                        this.user.userPhone=s.data.userPhone
                        this.user.userEmail=s.data.userEmail
                        this.user.creationTime=s.data.creationTime
                        this.user.userSex=s.data.userSex==1?"男":"女"


                     localStorage.setItem("username",this.user.userName)
                        localStorage.setItem("useremail",this.user.userEmail)
                        localStorage.setItem("userid",s.data.id)
                        
                     localStorage.setItem("id",this.user.id)
                    
                })
            }
        }
    }
</script>

<style scoped>

</style>